/*
 * Amazon Ads API - Sponsored Products
 * Use the Amazon Ads API for Sponsored Products for campaign, ad group, keyword, negative keyword, and product ad management operations. For more information about Sponsored Products, see the [Sponsored Products Support Center](https://advertising.amazon.com/help?entityId=ENTITY3CWETCZD9HEG2#GWGFKPEWVWG2CLUJ). For onboarding information, see the [account setup](setting-up/account-setup) topic.<br/><br/> 
 *
 * The version of the OpenAPI document: 2.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.openapitools.client.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.ExpressionType;
import org.openapitools.client.model.State;
import org.openapitools.client.model.TargetingExpressionPredicate;
import org.openapitools.jackson.nullable.JsonNullable;

/**
 * TargetingClauseEx
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-04-12T19:05:39.971406+08:00[Asia/Shanghai]")
public class TargetingClauseEx {
  public static final String SERIALIZED_NAME_TARGET_ID = "targetId";
  @SerializedName(SERIALIZED_NAME_TARGET_ID)
  private BigDecimal targetId;

  public static final String SERIALIZED_NAME_CAMPAIGN_ID = "campaignId";
  @SerializedName(SERIALIZED_NAME_CAMPAIGN_ID)
  private BigDecimal campaignId;

  public static final String SERIALIZED_NAME_AD_GROUP_ID = "adGroupId";
  @SerializedName(SERIALIZED_NAME_AD_GROUP_ID)
  private BigDecimal adGroupId;

  public static final String SERIALIZED_NAME_STATE = "state";
  @SerializedName(SERIALIZED_NAME_STATE)
  private State state;

  public static final String SERIALIZED_NAME_EXPRESSION = "expression";
  @SerializedName(SERIALIZED_NAME_EXPRESSION)
  private List<TargetingExpressionPredicate> expression = null;

  public static final String SERIALIZED_NAME_RESOLVED_EXPRESSION = "resolvedExpression";
  @SerializedName(SERIALIZED_NAME_RESOLVED_EXPRESSION)
  private List<TargetingExpressionPredicate> resolvedExpression = null;

  public static final String SERIALIZED_NAME_EXPRESSION_TYPE = "expressionType";
  @SerializedName(SERIALIZED_NAME_EXPRESSION_TYPE)
  private ExpressionType expressionType;

  public static final String SERIALIZED_NAME_BID = "bid";
  @SerializedName(SERIALIZED_NAME_BID)
  private Float bid;

  public static final String SERIALIZED_NAME_CREATION_DATE = "creationDate";
  @SerializedName(SERIALIZED_NAME_CREATION_DATE)
  private BigDecimal creationDate;

  public static final String SERIALIZED_NAME_LAST_UPDATED_DATE = "lastUpdatedDate";
  @SerializedName(SERIALIZED_NAME_LAST_UPDATED_DATE)
  private BigDecimal lastUpdatedDate;

  /**
   * The computed status of the targeting clause. See the [developer notes](https://advertising.amazon.com/API/docs/en-us/get-started/developer-notes) for more information.
   */
  @JsonAdapter(ServingStatusEnum.Adapter.class)
  public enum ServingStatusEnum {
    TARGETING_CLAUSE_ARCHIVED("TARGETING_CLAUSE_ARCHIVED"),
    
    TARGETING_CLAUSE_PAUSED("TARGETING_CLAUSE_PAUSED"),
    
    TARGETING_CLAUSE_STATUS_LIVE("TARGETING_CLAUSE_STATUS_LIVE"),
    
    TARGETING_CLAUSE_POLICING_SUSPENDED("TARGETING_CLAUSE_POLICING_SUSPENDED"),
    
    CAMPAIGN_OUT_OF_BUDGET("CAMPAIGN_OUT_OF_BUDGET"),
    
    AD_GROUP_PAUSED("AD_GROUP_PAUSED"),
    
    AD_GROUP_ARCHIVED("AD_GROUP_ARCHIVED"),
    
    CAMPAIGN_PAUSED("CAMPAIGN_PAUSED"),
    
    CAMPAIGN_ARCHIVED("CAMPAIGN_ARCHIVED"),
    
    ACCOUNT_OUT_OF_BUDGET("ACCOUNT_OUT_OF_BUDGET"),
    
    PENDING_START_DATE("PENDING_START_DATE");

    private String value;

    ServingStatusEnum(String value) {
      this.value = value;
    }

    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    public static ServingStatusEnum fromValue(String value) {
      for (ServingStatusEnum b : ServingStatusEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter<ServingStatusEnum> {
      @Override
      public void write(final JsonWriter jsonWriter, final ServingStatusEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public ServingStatusEnum read(final JsonReader jsonReader) throws IOException {
        String value =  jsonReader.nextString();
        return ServingStatusEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_SERVING_STATUS = "servingStatus";
  @SerializedName(SERIALIZED_NAME_SERVING_STATUS)
  private ServingStatusEnum servingStatus;


  public TargetingClauseEx targetId(BigDecimal targetId) {
    
    this.targetId = targetId;
    return this;
  }

   /**
   * The target identifier.
   * @return targetId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The target identifier.")

  public BigDecimal getTargetId() {
    return targetId;
  }


  public void setTargetId(BigDecimal targetId) {
    this.targetId = targetId;
  }


  public TargetingClauseEx campaignId(BigDecimal campaignId) {
    
    this.campaignId = campaignId;
    return this;
  }

   /**
   * The identifier of the campaign to which this target is associated.
   * @return campaignId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The identifier of the campaign to which this target is associated.")

  public BigDecimal getCampaignId() {
    return campaignId;
  }


  public void setCampaignId(BigDecimal campaignId) {
    this.campaignId = campaignId;
  }


  public TargetingClauseEx adGroupId(BigDecimal adGroupId) {
    
    this.adGroupId = adGroupId;
    return this;
  }

   /**
   * The identifier of the ad group to which this target is associated.
   * @return adGroupId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The identifier of the ad group to which this target is associated.")

  public BigDecimal getAdGroupId() {
    return adGroupId;
  }


  public void setAdGroupId(BigDecimal adGroupId) {
    this.adGroupId = adGroupId;
  }


  public TargetingClauseEx state(State state) {
    
    this.state = state;
    return this;
  }

   /**
   * Get state
   * @return state
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public State getState() {
    return state;
  }


  public void setState(State state) {
    this.state = state;
  }


  public TargetingClauseEx expression(List<TargetingExpressionPredicate> expression) {
    
    this.expression = expression;
    return this;
  }

  public TargetingClauseEx addExpressionItem(TargetingExpressionPredicate expressionItem) {
    if (this.expression == null) {
      this.expression = new ArrayList<TargetingExpressionPredicate>();
    }
    this.expression.add(expressionItem);
    return this;
  }

   /**
   * The targeting expression.
   * @return expression
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The targeting expression.")

  public List<TargetingExpressionPredicate> getExpression() {
    return expression;
  }


  public void setExpression(List<TargetingExpressionPredicate> expression) {
    this.expression = expression;
  }


  public TargetingClauseEx resolvedExpression(List<TargetingExpressionPredicate> resolvedExpression) {
    
    this.resolvedExpression = resolvedExpression;
    return this;
  }

  public TargetingClauseEx addResolvedExpressionItem(TargetingExpressionPredicate resolvedExpressionItem) {
    if (this.resolvedExpression == null) {
      this.resolvedExpression = new ArrayList<TargetingExpressionPredicate>();
    }
    this.resolvedExpression.add(resolvedExpressionItem);
    return this;
  }

   /**
   * The resolved targeting expression.
   * @return resolvedExpression
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The resolved targeting expression.")

  public List<TargetingExpressionPredicate> getResolvedExpression() {
    return resolvedExpression;
  }


  public void setResolvedExpression(List<TargetingExpressionPredicate> resolvedExpression) {
    this.resolvedExpression = resolvedExpression;
  }


  public TargetingClauseEx expressionType(ExpressionType expressionType) {
    
    this.expressionType = expressionType;
    return this;
  }

   /**
   * Get expressionType
   * @return expressionType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public ExpressionType getExpressionType() {
    return expressionType;
  }


  public void setExpressionType(ExpressionType expressionType) {
    this.expressionType = expressionType;
  }


  public TargetingClauseEx bid(Float bid) {
    
    this.bid = bid;
    return this;
  }

   /**
   * The bid for ads sourced using the target. Targets that do not have bid values in listTargetingClauses will inherit the defaultBid from the adGroup level. This table details the maximum allowable bid (in local currency) for keywords by marketplace: | Marketplace | Currency | Min / Max bid for SP | | --- | --- | --- | | US | USD | 0.02 / 1000 | | CA | CAD | 0.02 / 1000 | | UK | GBP | 0.02 / 1000 | | DE | EUR | 0.02 / 1000 | | FR | EUR | 0.02 / 1000 | | ES | EUR | 0.02 / 1000 | | IT | EUR | 0.02 / 1000 | | JP | JPY | 2.0 / 100000 | | AU | AUD | 0.10 / 1410 | | AE | AED | 0.24 / 184.0 |
   * minimum: 0.02
   * @return bid
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The bid for ads sourced using the target. Targets that do not have bid values in listTargetingClauses will inherit the defaultBid from the adGroup level. This table details the maximum allowable bid (in local currency) for keywords by marketplace: | Marketplace | Currency | Min / Max bid for SP | | --- | --- | --- | | US | USD | 0.02 / 1000 | | CA | CAD | 0.02 / 1000 | | UK | GBP | 0.02 / 1000 | | DE | EUR | 0.02 / 1000 | | FR | EUR | 0.02 / 1000 | | ES | EUR | 0.02 / 1000 | | IT | EUR | 0.02 / 1000 | | JP | JPY | 2.0 / 100000 | | AU | AUD | 0.10 / 1410 | | AE | AED | 0.24 / 184.0 |")

  public Float getBid() {
    return bid;
  }


  public void setBid(Float bid) {
    this.bid = bid;
  }


  public TargetingClauseEx creationDate(BigDecimal creationDate) {
    
    this.creationDate = creationDate;
    return this;
  }

   /**
   * The epoch time that the targeting clause was created.
   * @return creationDate
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The epoch time that the targeting clause was created.")

  public BigDecimal getCreationDate() {
    return creationDate;
  }


  public void setCreationDate(BigDecimal creationDate) {
    this.creationDate = creationDate;
  }


  public TargetingClauseEx lastUpdatedDate(BigDecimal lastUpdatedDate) {
    
    this.lastUpdatedDate = lastUpdatedDate;
    return this;
  }

   /**
   * The epoch time that the targeting clause was updated.
   * @return lastUpdatedDate
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The epoch time that the targeting clause was updated.")

  public BigDecimal getLastUpdatedDate() {
    return lastUpdatedDate;
  }


  public void setLastUpdatedDate(BigDecimal lastUpdatedDate) {
    this.lastUpdatedDate = lastUpdatedDate;
  }


  public TargetingClauseEx servingStatus(ServingStatusEnum servingStatus) {
    
    this.servingStatus = servingStatus;
    return this;
  }

   /**
   * The computed status of the targeting clause. See the [developer notes](https://advertising.amazon.com/API/docs/en-us/get-started/developer-notes) for more information.
   * @return servingStatus
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The computed status of the targeting clause. See the [developer notes](https://advertising.amazon.com/API/docs/en-us/get-started/developer-notes) for more information.")

  public ServingStatusEnum getServingStatus() {
    return servingStatus;
  }


  public void setServingStatus(ServingStatusEnum servingStatus) {
    this.servingStatus = servingStatus;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    TargetingClauseEx targetingClauseEx = (TargetingClauseEx) o;
    return Objects.equals(this.targetId, targetingClauseEx.targetId) &&
        Objects.equals(this.campaignId, targetingClauseEx.campaignId) &&
        Objects.equals(this.adGroupId, targetingClauseEx.adGroupId) &&
        Objects.equals(this.state, targetingClauseEx.state) &&
        Objects.equals(this.expression, targetingClauseEx.expression) &&
        Objects.equals(this.resolvedExpression, targetingClauseEx.resolvedExpression) &&
        Objects.equals(this.expressionType, targetingClauseEx.expressionType) &&
        Objects.equals(this.bid, targetingClauseEx.bid) &&
        Objects.equals(this.creationDate, targetingClauseEx.creationDate) &&
        Objects.equals(this.lastUpdatedDate, targetingClauseEx.lastUpdatedDate) &&
        Objects.equals(this.servingStatus, targetingClauseEx.servingStatus);
  }

  private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
    return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
  }

  @Override
  public int hashCode() {
    return Objects.hash(targetId, campaignId, adGroupId, state, expression, resolvedExpression, expressionType, bid, creationDate, lastUpdatedDate, servingStatus);
  }

  private static <T> int hashCodeNullable(JsonNullable<T> a) {
    if (a == null) {
      return 1;
    }
    return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class TargetingClauseEx {\n");
    sb.append("    targetId: ").append(toIndentedString(targetId)).append("\n");
    sb.append("    campaignId: ").append(toIndentedString(campaignId)).append("\n");
    sb.append("    adGroupId: ").append(toIndentedString(adGroupId)).append("\n");
    sb.append("    state: ").append(toIndentedString(state)).append("\n");
    sb.append("    expression: ").append(toIndentedString(expression)).append("\n");
    sb.append("    resolvedExpression: ").append(toIndentedString(resolvedExpression)).append("\n");
    sb.append("    expressionType: ").append(toIndentedString(expressionType)).append("\n");
    sb.append("    bid: ").append(toIndentedString(bid)).append("\n");
    sb.append("    creationDate: ").append(toIndentedString(creationDate)).append("\n");
    sb.append("    lastUpdatedDate: ").append(toIndentedString(lastUpdatedDate)).append("\n");
    sb.append("    servingStatus: ").append(toIndentedString(servingStatus)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}

